home *** CD-ROM | disk | FTP | other *** search
/ Amiga Packmags / NewsFlash - Issue 07 (1990-01)(UGA - 17-Bit Software)(Disk 1 of 2)[a intro].zip / NewsFlash - Issue 07 (1990-01)(UGA - 17-Bit Software)(Disk 1 of 2)[a intro].adf / sources / LineBouncer.S < prev    next >
Text File  |  1996-12-24  |  4KB  |  199 lines

  1. start:    move.l        4,a6
  2.     jsr        -132(a6)    ;no multitasking
  3.     lea        gfxname,a1
  4.     jsr        -408(a6)    ;open gfxlib
  5.     move.l        d0,gfxbase
  6.  
  7.     move.l        gfxbase,a6    ;First
  8.     lea        bitmap,a0    ;Initialize
  9.     move.l        #1,d0        ;bitmap
  10.     move.l        #384,d1        ;and rasport
  11.     move.l        #256,d2        ;for used plane
  12.     jsr        -390(a6)    ; InitBitMap
  13.     lea        rastport,a1
  14.     jsr        -198(a6)    ; InitRastPort
  15.     move.l        #bitmap,r_bitmap
  16.  
  17.     lea        textattr,a0
  18.     jsr        -72(a6)        ;OpenFont
  19.     move.l        d0,a0
  20.     lea        rastport,a1
  21.     jsr        -66(a6)        ;Setfont to topaz.9
  22.  
  23.     move.l        #plane,d0    ;put bitplane
  24.     move.w        d0,pl+6        ;in copperlist
  25.     swap        d0        ;high and low
  26.     move.w        d0,pl+2        ;word
  27.  
  28.     move.l        gfxbase,a0
  29.     move.l        $32(a0),oldcop
  30.     move.l        #newcop,$32(a0)    ;set new copperlist
  31.     move.l        $6c,oldirq
  32.     move.l        #newirq,$6c    ;and new irq vector
  33. wait:    btst        #6,$bfe001    ;wait for mouse
  34.     bne        wait
  35.     move.l        oldirq,$6c    ;old irq vector back
  36.     move.l        gfxbase,a0    ;and old copperlist
  37.     move.l        oldcop,$32(a0)
  38.     move.l        4,a6
  39.     jsr        -138(a6)    ;multitasking back on
  40.     clr.l        d0        ;no cli error
  41.     rts                ;bye
  42.  
  43. newirq:    bsr        scroll
  44.     bsr        doit
  45.     dc.w        $4ef9        ;code for jmp
  46. oldirq:    dc.l        0        ;to old irq vector
  47.  
  48. scroll:    move.l        gfxbase,a6
  49.     move.l        #2,d0        ;dx, 2 pixels to the left
  50.     clr.l        d1        ;dy
  51.     move.l        #0,d2        ;min x
  52.     move.l        #10,d3        ;min y
  53.     move.l        #383,d4        ;max x
  54.     move.l        #25,d5        ;max y
  55.     lea        rastport,a1    ;rastport pointer
  56.     jsr        -396(a6)    ;ScrollRaster
  57.     subq.w        #1,scrcount    ;Counter for newtext
  58.     beq        newtext        ;is zero->new char
  59.     rts                ;else->bye ??
  60. newtext:move.w        #5,scrcount    ;newtext delay set
  61.     move.l        gfxbase,a6
  62.     lea        rastport,a1
  63.     move.l        #374,d0        ;x
  64.     move.l        #18,d1        ;y
  65.     jsr        -240(a6)    ;move
  66.     move.l        stringpointer,a0;pointer to string
  67.     move.l        #1,d0        ;1 char
  68.     jsr        -60(a6)
  69.     addq.l        #1,stringpointer;Next char
  70.     cmpi.l        #endstring,stringpointer
  71.     bne        notend        ;end of string reached
  72.     move.l        #string,stringpointer;Start al over
  73. notend:    rts
  74.  
  75. top=2
  76. down=240
  77. left=16
  78. right=364
  79.  
  80. doit:    lea        oldxy,a3
  81.     move.l        gfxbase,a6
  82.     lea        rastport,a1
  83.     move.l        #0,d0
  84.     jsr        -342(a6)    ;set color
  85.     lea        rastport,a1
  86.     move.l        (a3),d0
  87.     move.l        4(a3),d1
  88.     jsr        -240(a6)    ;move
  89.     lea        rastport,a1
  90.     move.l        8(a3),d0
  91.     move.l        12(a3),d1
  92.     jsr        -246(a6)    ;draw to ->erase old line
  93.     bsr        roll        ;cycle through lines
  94.     lea        oldxy,a3
  95.  
  96.     move.l        gfxbase,a6
  97.     lea        rastport,a1
  98.     move.l        #1,d0        ;setcolor
  99.     jsr        -342(a6)
  100.     lea        point1,a2    ;calc new points
  101.     bsr        calc        ;first point1
  102.     move.l        gfxbase,a6
  103.     lea        rastport,a1
  104.     move.l        d0,496(a3)
  105.     move.l        d1,500(a3)
  106.     jsr        -240(a6)    ;move
  107.     lea        point2,a2
  108.     bsr        calc        ;then point2
  109.     move.l        gfxbase,a6
  110.     lea        rastport,a1
  111.     move.l        d0,504(a3)
  112.     move.l        d1,508(a3)
  113.     jsr        -246(a6)    ;draw new line
  114.      subq.b        #1,bcount    ;delay for gravity
  115.     bne        bnot0
  116.     move.b        #5,bcount
  117. bnot0:    rts
  118.  
  119. oldxy:    blk.l    128,0
  120.  
  121. roll:    move.l        #123,d7        ;this routine
  122. sloop:    move.l        16(a3),(a3)    ;cycles through
  123.     addq.l        #4,a3        ;coords
  124.     dbra        d7,sloop    ;so first line becomes last
  125.     rts                ;at some time
  126.         
  127. calc:    move.l        8(a2),d0    ;x-coor.
  128.     move.l        12(a2),d1    ;y-coor.
  129.     add.l        (a2),d0        ;x=x+dx
  130.     move.l        d0,8(a2)
  131.     add.l        4(a2),d1    ;y=y+dy
  132.     move.l        d1,12(a2)
  133.     cmpi.b        #1,bcount    ;time for gravity
  134.     bne        noacc        ;yes
  135.     addq.l        #1,4(a2)    ;so increase speed
  136. noacc:    cmpi.l        #top,d1        ;bounce
  137.     bge        skp1
  138.     bra        neg1
  139. skp1:    cmpi.l        #down,d1
  140.     ble        skp2
  141. neg1:    neg.l        4(a2)
  142.  
  143. skp2:    cmpi.l        #left,d0
  144.     bge        skp3
  145.     bra        neg2
  146. skp3:    cmpi.l        #right,d0
  147.     ble        skp4
  148. neg2:    neg.l        (a2)
  149. skp4:    rts
  150.  
  151. point1:        dc.l    2
  152.         dc.l    2
  153.         dc.l    100
  154.         dc.l    100
  155. point2:        dc.l    -3
  156.         dc.l    0
  157.         dc.l    100
  158.         dc.l    40
  159.  
  160. newcop:    dc.w    $0180,$0000,$0182,$0fff        ;colors
  161.     dc.w    $008e,$296a,$0090,$29fa        ;DIWStart/DIWStop
  162.     dc.w    $0092,$0028,$0094,$00d8        ;DFFStart/DFFStop
  163.     dc.w    $0108,$0002,$010a,$0002        ;BPL0MOD/BPL1MOD
  164. pl:    dc.w    $00e0,$0000,$00e2,$0000        ;bitplane pointers
  165.     dc.w    $0100,$1000            ;1 bitplane on
  166.     dc.w    $ffff,$fffe
  167.  
  168. plane:    blk.b    48*256,0
  169. bitmap:    dc.w    0,0,0,0        ;This is the bitmap structure
  170.     dc.l    plane        ;as used by the system
  171.     dc.l    0        ;bitplane2 off
  172.     dc.l    0        ;bitplane3 off
  173.     dc.l    0        ;bitplane4 off
  174.     dc.l    0        ;bitplane5 off
  175.     dc.l    0        ;bitplane6 off
  176. rastport:
  177.     dc.l    0        ;and the rastport structure
  178. r_bitmap:
  179.     dc.l    0        ;bitmap pointer in rastport struct
  180.     blk.b    102,0
  181. textattr:
  182.     dc.l    fontname    ;the textattr structure
  183.     dc.w    9        ;fontsize
  184.     dc.b    0,0        ;style,flags
  185.  
  186. stringpointer:    dc.l    string
  187. scrcount:    dc.w    1
  188. oldcop:        dc.l    0
  189. gfxbase:    dc.l    0
  190. gfxname:    dc.b    "graphics.library",0
  191. fontname:    dc.b    "topaz.font",0
  192. bcount:        dc.b    1
  193. string: dc.b    " THE TIMECIRCLE PRESENTS ..."
  194.     dc.b    " A FLASHY LINEBOUNCER (WITH GRAVITY) EFFECT ... "
  195.     dc.b    "CODED BY BRIAN POSTMA FOR THE NEWSFLASH MAGAZINE"
  196.     dc.b    " ......       "
  197. endstring:
  198.  
  199.